﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.24    特批业务审批表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_ADU_SPECAIL: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_ADU_SPECAIL()
		{}
		#region Model
		private long _id;
		private long _loanid;
		private long _proid;
		private long _conid;
		private long _pid;
		private string _specialtype;
		private long _submitdepart;
		private string _submituser;
		private Nullable<DateTime> _audittime;
		private int _auditstatus;
		private string _remark;
		private long _todepart;
		private string _touser;
		/// <summary>
		/// 记录ID唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 放款记录IDTb_Loan_Main.ID
		/// </summary>
		[DataMember]
		public long LOANID
		{
			get{return _loanid;}
			set{
				if ( _loanid!= value)
				{
					 _loanid = value;
					OnPropertyChanged("LOANID");
				}
			}
		}
		/// <summary>
		/// 立项申请记录ID
		/// </summary>
		[DataMember]
		public long PROID
		{
			get{return _proid;}
			set{
				if ( _proid!= value)
				{
					 _proid = value;
					OnPropertyChanged("PROID");
				}
			}
		}
		/// <summary>
		/// 合同记录ID
		/// </summary>
		[DataMember]
		public long CONID
		{
			get{return _conid;}
			set{
				if ( _conid!= value)
				{
					 _conid = value;
					OnPropertyChanged("CONID");
				}
			}
		}
		/// <summary>
		/// 特批业务ID外键。关联特批业务表ID
		/// </summary>
		[DataMember]
		public long PID
		{
			get{return _pid;}
			set{
				if ( _pid!= value)
				{
					 _pid = value;
					OnPropertyChanged("PID");
				}
			}
		}
		/// <summary>
		/// 特批业务类型特批业务类型。
        ///1提前结清、2展期、6费用减免、3还款计划变更、4放款审批,5特批业务
		/// </summary>
		[DataMember]
		public string SPECIALTYPE
		{
			get{return _specialtype;}
			set{
				if ( _specialtype!= value)
				{
					 _specialtype = value;
					OnPropertyChanged("SPECIALTYPE");
				}
			}
		}
		/// <summary>
		/// 审批机构提交到的机构ID。如果没有设置审批人，则此项不显示，否则必选
		/// </summary>
		[DataMember]
		public long SUBMITDEPART
		{
			get{return _submitdepart;}
			set{
				if ( _submitdepart!= value)
				{
					 _submitdepart = value;
					OnPropertyChanged("SUBMITDEPART");
				}
			}
		}
		/// <summary>
		/// 审批人提交给谁。关联用户名。如果没有设置审批人，则此项不显示，否则必选
		/// </summary>
		[DataMember]
		public string SUBMITUSER
		{
			get{return _submituser;}
			set{
				if ( _submituser!= value)
				{
					 _submituser = value;
					OnPropertyChanged("SUBMITUSER");
				}
			}
		}
		/// <summary>
		/// 审批时间审批时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> AUDITTIME
		{
			get{return _audittime;}
			set{
				if ( _audittime!= value)
				{
					 _audittime = value;
					OnPropertyChanged("AUDITTIME");
				}
			}
		}
		/// <summary>
		/// 审批状态1.同意 2.拒绝  
		/// </summary>
		[DataMember]
		public int AUDITSTATUS
		{
			get{return _auditstatus;}
			set{
				if ( _auditstatus!= value)
				{
					 _auditstatus = value;
					OnPropertyChanged("AUDITSTATUS");
				}
			}
		}
		/// <summary>
		/// 审批意见审批意见。
		/// </summary>
		[DataMember]
		public string REMARK
		{
			get{return _remark;}
			set{
				if ( _remark!= value)
				{
					 _remark = value;
					OnPropertyChanged("REMARK");
				}
			}
		}
		/// <summary>
		/// 提交到机构
		/// </summary>
		[DataMember]
		public long TODEPART
		{
			get{return _todepart;}
			set{
				if ( _todepart!= value)
				{
					 _todepart = value;
					OnPropertyChanged("TODEPART");
				}
			}
		}
		/// <summary>
		/// 提交给
		/// </summary>
		[DataMember]
		public string TOUSER
		{
			get{return _touser;}
			set{
				if ( _touser!= value)
				{
					 _touser = value;
					OnPropertyChanged("TOUSER");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

